<?php

declare(strict_types=1);
/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://hyperf.wiki
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 */

use App\Controller\AsrController;
use App\Controller\GrpcController;
use App\Controller\HiController;
use App\Middleware\GatewayMiddleware;
use App\Modules\Company\Controller\CompanyController;
use App\Modules\GrpcApi\Controller\ApiController;
use App\Modules\Ws\Controller\WebSocketController;
use Hyperf\HttpServer\Router\Router;

Router::addRoute(['GET', 'POST', 'HEAD'], '/', 'App\Controller\IndexController@index');
//
Router::get('/favicon.ico', function () {
    return '';
});

Router::get('/asr', [AsrController::class, 'index']);

Router::get('/grpc-test', [GrpcController::class, 'hello']);

Router::get('/get-bus', [ApiController::class, 'getBusLine']);

Router::addServer('grpc', function () {
    Router::addGroup('/grpc.hi', function () {
        Router::post('/sayHello', [HiController::class, 'sayHello']);
    });
    Router::addGroup('/api.getBusLine', function () {
//        echo 123;
        Router::post('/getBus', [ApiController::class, 'getBusLineByGrpc']);
    });
});
Router::addGroup('/company', function () {
    Router::get('/', [CompanyController::class, 'index']);
}, ['middleware' => [GatewayMiddleware::class]]);

Router::addServer('ws', function () {
    Router::get('/ws', WebSocketController::class);
});


